module MC.Order {
    export class orderDocking {
        public constructor() {
            this.init();
        }
        private init() {
            MC.apiD('getOrderDocking', {}, (data: any) => {
                console.log(data);
                for (let i = 0; i < data.length; i++) {
                    this.addli(data[i]);
                }
            });
        }
        private addli(data: any) {
            let button = ` `;
            if (data.zhongbiao) {
                button = `<a class="button kongzhitai" href="/h5/order/kongzhitai.html?out_trade_no=` + data.out_trade_no + `">控制台</a>`;
            }

            let html = `<li class="li clearfix">
                <a class="picDiv"  href="/h5/order/orderShow.html?id=`+ data.bale + `">
                    <img src="`+ data.img + `" class="img" />
                    <i class="tagico  qiangdan"></i>
                </a>
                <ul class="conul">
                    <li class="cli">
                        <span class="title">订单名称:</span>
                        <span class="value">`+ data.name + `</span>
                    </li>
                    <li class="cli">
                        <span class="title">公司名称:</span>
                        <span class="value">`+ data.com_name + `</span>
                    </li>
                    <li class="cli">
                        <span class="title">交货期限:</span>
                        <span class="value">`+ data.period + `</span>
                    </li>
                    <li class="cli buttondiv">
                        <a class="button jiaoliu" call="`+ data.jiguang_id + `">商务交流</a>
                        `+ button + `
                        <span class="status value">状态:`+ data.status + `</span>
                    </li>
                </ul>
            </li>`;
            $('.myOrder_List').append(html);
        }


        private addli_del(data: any) {
            let button = ` 
                        <a class="status">`+ data.status + `</a> 
                    `;
            if (data.zhongbiao) {
                button = ` 
                        <a class="button kongzhitai" href="/h5/order/kongzhitai.html?out_trade_no=`+ data.out_trade_no + `">控制台</a>
                        <a class="button jiaoliu" call="`+ data.jiguang_id + `">商务交流</a>
                        <a class="status">`+ data.status + `</a> 

                    `;
            }
            let html = `<li class="detail" out_trade_no="` + data.out_trade_no + `" bale="` + data.bale + `">
                <a href="/h5/order/orderShow.html?id=`+ data.bale + `">
                    <span class="detail__span"
                          style="background-image:url(`+ data.img + `)" alt="">
                    </span>
                </a>
                <ul>
                    <li>
                        <span>订单名称：</span>
                        <span>`+ data.name + `</span>
                        <span></span>

                    </li>
                    <li >
                        <span>公司名称：</span>
                        <span>`+ data.com_name + `</span>
                        <span></span>
                    </li>
                    <li>
                        <span>交货期限：</span>
                        <span>`+ data.period + ` </span>
                    </li>
                   <li> `+ button + `</li>
                </ul>
            </li>`;

            $('.myOrderList').append(html);
        }
    }
}